<template>
  <input type="text" id="input1">
  <button @click="postdata">
    check
  </button>
</template>

<script>
import axios from 'axios'
axios.defaults.baseURL = 'http://127.0.0.1:5000'
const test_data = axios.create({
  url:"",
  timeout: 1000,
  headers: {'X-Custom-Header': 'foobar'}
});


export default {
  name: 'HelloWorld',
  props: {
    msg: String
  },
  methods: {
    postdata() {
      var inputValue = (document.getElementById("input1")).value
      console.log(inputValue)
      const postdatas = {
        input: inputValue
      }

      test_data.get("/check12345", { params: postdatas }).then(response => {
        console.log(response)
        if (response.status === 200) {
          // this.existTables = response.data.data;
          console.log('链接后端成功，后端数据为');
          console.log(response.data)
        } else {
          console.log('链接后端失败');
        }
      })
    }
  }
}

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}

ul {
  list-style-type: none;
  padding: 0;
}

li {
  display: inline-block;
  margin: 0 10px;
}

a {
  color: #42b983;
}
</style>
